import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/Home.vue'
import MembershipCardView from '@/views/membershipManagement/MembershipCardView.vue'
import AddUser from '@/views/membershipManagement/AddUser.vue';

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: ()=>import('@/views/Login.vue'),
    meta: { notUseLayout: true }
  },
  {
    path: '/register',
    name: 'Register',
    component: ()=>import('@/views/Register.vue'),
    meta: { notUseLayout: true }
  },
  {
    path: '/home/dashboard',
    name: 'Dashboard',
    component: ()=>import('@/views/Dashboard.vue'),
    children:[
      {
        path: '/home',
        name: 'Home',
        component: Home,
        meta: { title: '首页', icon: 'HomeFilled', top: true }
      },
      {
        path: '/info',
        name: 'Info',
        component: () => import('@/views/Info.vue')
      },
      {
        path: '/membership-management',
        name: 'MembershipManagement',
        meta: { title: '会员管理', icon: 'Platform',top: true},
        children: [
          {
            path: 'membership',
            name: 'Membership',
            component: () => import('@/views/membershipManagement/Membership.vue'),
            meta: { title: '会员', icon: 'User' }
          },
          {
            path: 'membership-card',
            name: 'MembershipCard',
            component: () => import('@/views/membershipManagement/MembershipCard.vue'),
            meta: { title: '会员卡', icon: 'CreditCard' }
          },
          {
            path: 'membership-binding',
            name: 'MembershipBinding',
            component: () => import('@/views/membershipManagement/MembershipBinding.vue'),
            meta: { title: '会员绑定', icon: 'Link' }
          }
        ]
      },
      {
        path: '/group-class-management',
        name: 'GroupClassManagement',
        meta: { title: '团课管理', icon: 'List', top: true },
        children: [
          {
            path: 'group-class',
            name: 'GroupClass',
            component: () => import('@/views/groupClassManagement/GroupClass.vue'),
            meta: { title: '团课课程', icon: 'Notebook' }
          },
          {
            path: 'group-class-schedule',
            name: 'GroupClassSchedule',
            component: () => import('@/views/groupClassManagement/GroupClassSchedule.vue'),
            meta: { title: '团课课程表', icon: 'Calendar' }
          },
          {
            path: 'group-class-reservation-settings',
            name: 'GroupClassReservationSettings',
            component: () => import('@/views/groupClassManagement/GroupClassReservationSettings.vue'),
            meta: { title: '团课预约设置', icon: 'Setting' }
          }
        ]
      },
      {
        path: '/teacher-management',
        name: 'TeacherManagement',
        component: () => import('@/views/teacherManagement/TeacherManagement.vue'),
        meta: { title: '教师管理', icon: 'Avatar', top: true }
      },
      {
        path:'/teacher-detail',
        name: 'TeacherDetail',
        component: () => import('@/views/teacherManagement/TeacherDetail.vue'),
        meta: { title: '教师详情', icon: 'Avatar', top: false }
      },
      {
        path: '/statistics',
        name: 'Statistics',
        meta: { title: '数据统计', icon: 'TrendCharts', top: true },
        children: [
          {
            path: 'membership-card-statistics',
            name: 'MembershipCardStatistics',
            component: () => import('@/views/statistics/MembershipCardStatistics.vue'),
            meta: { title: '会员卡统计', icon: 'Postcard' }
          },
          {
            path: 'charge-statistics',
            name: 'ChargeStatistics',
            component: () => import('@/views/statistics/ChargeStatistics.vue'),
            meta: { title: '收费统计', icon: 'Money' }
          },
          {
            path: 'lesson-statistics',
            name: 'LessonStatistics',
            component: () => import('@/views/statistics/LessonStatistics.vue'),
            meta: { title: '课消统计', icon: 'School' }
          },
          {
            path: 'total-class-statistics',
            name: 'TotalClassStatistics',
            component: () => import('@/views/statistics/TotalClassStatistics.vue'),
            meta: { title: '总课次统计', icon: 'DataAnalysis' }
          },
          {
            path: 'lose&increasing-statistics',
            name: 'Lose&IncreasingStatistics',
            component: () => import('@/views/statistics/Lose&IncreasingStatistics.vue'),
            meta: { title: '新增与流失统计', icon: 'SetUp' }
          },
        ]
      },
    ]
  },
  {
    path: '/membership-card-view/:name',
    name: 'MembershipCardView',
    component: MembershipCardView,
    meta: { title: '会员卡详情', top: false }
  },
  {
    path: '/add-user',
    name: 'AddUser',
    component: () => import('@/views/membershipManagement/AddUser.vue'),
    meta: { title: '添加用户', top: false }
  },
  {
    path: '/bind-membership-card/:userId',
    name: 'BindMembershipCard',
    component: () => import('@/views/membershipManagement/BindMembershipCard.vue'),
    meta: { title: '绑定会员卡', top: false }
  },
  {
    path: '/add-membership-card',
    name: 'AddMembershipCard',
    component: () => import('@/views/membershipManagement/AddMembershipCard.vue'),
    meta: { title: '添加会员卡', top: false }
  },
   
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
